package com.my.fo.strategy.factory;

import com.my.fo.strategy.organization.inter.OrganizationExistTypeStrategy;
import com.my.fo.strategy.util.StrategyMapUtil;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

public class OrganizationExistTypeStrategyFactory {

    private static final Map<String, OrganizationExistTypeStrategy> strategyMap;

    static {
        try {
            strategyMap = StrategyMapUtil.getStrategyMap("com.my.fo.strategy.organization.existType", true);
        } catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | InstantiationException |
                 IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }

    public static OrganizationExistTypeStrategy getStrategy(String type) {
        return strategyMap.get(type);
    }

}
